import axios from 'axios'
import { HTTP_URI } from '@/api/api'

axios.defaults.baseURL = HTTP_URI.BASEURL

axios.interceptors.request.use(
    config => {
        return config
    },
    err => {
        return Promise.reject(err);
    }
)

axios.interceptors.response.use(
    resp => {
        //在这里对返回的数据进行处理
        console.log(resp.data, '网络正常');
        return resp.data;
    },
    err => {
        console.log('网络开了小差！请重试...');
        return Promise.reject(err)
    }
)

export default axios